import React from "react";
import { Button } from "antd";
import { useDispatch, useSelector } from "react-redux";
import {increment} from "../slices/testSlice";
import { fetchStudent } from "../slices/studentSlice";

function TestPage() {
    let count = useSelector((state) => state.test.count);
    let student = useSelector((state) => state.student.student);
    console.log("student",student)
    const dispatch = useDispatch();
    const handleChange = () => {
        // dispatch(increment(1));
        dispatch(fetchStudent("630c24411849ac7430bf1229"));
    }
    return (    
        <div>
            <Button onClick={handleChange}>++</Button>
            <span>{count}</span>
            <span>{student.name}</span>
        </div>
    );
}

export default TestPage;
